import { defHttp } from "@/utils/http";

// ERP 资产维修地点 VO
export interface PropertyAddressVO {
	addrId: number; // 维修地点ID
	addrNo: string; // 维修地点编号
	name: string; // 维修地点名称
	sqNumb: number; // 顺序号
	addrDetail: string; // 维修地点地址
	parentId: number; // 父级ID
}

// ERP 资产维修地点 API
export const PropertyAddressApi = {
	// 查询资产维修地点分页
	getPropertyAddressPage: async (params: any) => {
		return await defHttp.get({ url: `/whs/mtn-address/page`, params });
	},

	// 查询资产维修地点详情
	getPropertyAddress: async (id: number) => {
		return await defHttp.get({ url: `/whs/mtn-address/get?id=` + id });
	},

	// 新增资产维修地点
	createPropertyAddress: async (data: PropertyAddressVO) => {
		return await defHttp.post({ url: `/whs/mtn-address/create`, data });
	},

	// 修改资产维修地点
	updatePropertyAddress: async (data: PropertyAddressVO) => {
		return await defHttp.put({ url: `/whs/mtn-address/update`, data });
	},

	// 删除资产维修地点
	deletePropertyAddress: async (id: number) => {
		return await defHttp.delete({
			url: `/whs/mtn-address/delete?id=` + id
		});
	},

	// 导出资产维修地点 Excel
	exportPropertyAddress: async (params: any) => {
		return await defHttp.download({ url: `/whs/mtn-address/export-excel`, params });
	}
};
